import { ListType, CarItem, ArrayType } from '@/types/pages/cart';
const getArr = (val: any, arr: Array<ListType>) => {
	arr.forEach((item: ListType) => {
		let type = true
		item.shopCartItemDiscounts.forEach((item2: CarItem) => {
			item2.shopCartItems.forEach((item3: ArrayType) => {
				if(val.value == item3.shopId) {
					item.type = val.checked
					item3.type = val.checked
				} else if (val.value == item3.cartId) {
					item3.type = val.checked
				}
				if(!item3.type) {
					type = false
				}
			});
		});
		item.type = type
	});
};

export default {
	getArr
};
